]<template>
	<view>
		<uni-search-bar radius="100" bgColor="#ffff"></uni-search-bar>
		<view class="list">
			<view class="row" v-for="(item,index) in arr" :key="index">
					<view class="products">
						<view class="imagebox" v>
							<image :src="baseUrl+item.img" mode="widthFix"></image>
							<text>{{item.goodsname}}</text>
						</view>
					</view>
					<view class="info">
						<text  space="nbsp">总计{{item.countnumber}}商品  </text>  
						<text>应付金额 ￥{{item.countmoney}}</text>
					</view>
			</view>
			
		</view>
		<view class="tishi">
			没有数据亲！
		</view>
	</view>
</template>

<script>
import uniSearchBar from '@/components/uni-search-bar/uni-search-bar.vue'
import {baseUrl} from "../../utils/config.js"
	export default{
		components: {uniSearchBar},
		data(){
			return{
				list:[],
				arr:[],
				baseUrl,
			}
		},
		async onLoad() {
			var {uid,token} = uni.getStorageSync("userInfo")
			// console.log(uid,token);
			var result = await this.http("/api/orders",{uid},token).catch(err=>{
				console.log(err);
			})
			// console.log(result);
			this.list = result.data.list
			console.log(this.list,"----");
			var list1 = [];
			this.list.forEach(item=>{
				var countmoney = item.countmoney;
				var countnumber = item.countnumber;
				var id = item.id;
				// console.log(item.child);
				item.child.forEach(item1=>{
					item1.countmoney = countmoney;
					item1.countnumber = countnumber;
					item1.id = id;
					// console.log(item1);
					this.arr.push(item1)
					console.log(this.arr);
				})
			})
		}
	}
</script>
<style>

	.row{
		margin: 10rpx 20rpx;
		/* height: 240rpx; */
		border: 1rpx solid #AAAAAA;
		border-radius: 30rpx;
	}
	
	.imagebox{
		float: left;
		margin:10rpx;
	}
	.products{
		overflow: hidden;
	}
	image{
		width: 160rpx;
		margin-left: 10rpx;
	}
	.info{
		/* position: absolute;
		top: 180rpx;
		right: 50rpx; */
		display: flex;
		justify-content: space-between;
		font-size: 25rpx;
		/* width: 340rpx; */
		padding: 20rpx;
		text-align: right;
	}
	.info text:nth-of-type(2){
		color: red;
	}
	.info text:nth-of-type(3){
		font-size: 20rpx;
		color: #AAAAAA;
	}
	.tishi{
		line-height: 200rpx;
		text-align: center;
		font-size: 40rpx;
		color: #006699;
	}
</style>
